import React, { useContext, useState, useMemo } from 'react'
import myContext from '../usecontext.js'
import { Table, Space } from 'antd';



export default function Cpu() {
  const seaver = useContext(myContext);
  const { cpu } = seaver
  // console.log(cpu);
  const columns = [
    {
      title: '属性',
      dataIndex: 'name',
      key: 'name',
    },
    {
      title: '值',
      dataIndex: 'value',
      key: 'value',
    }
  ]
  const data = [
    {
      key: '1',
      name: '核心数',
      value: cpu.cpuNum
    },
    {
      key: '3',
      name: '用户使用率',
      value: cpu.used + '%',
    },
    {
      key: '4',
      name: '系统使用率',
      value: cpu.sys + '%',
    },
    {
      key: '5',
      name: '当前空闲率',
      value: cpu.free + '%',
    },
  ]
  return (
    <Table bordered={true} pagination={false} columns={columns} dataSource={data} />
  )
}
